package com.dormitory.Servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import com.dormitory.dao.selectInformation;
@WebServlet("/editStudent")
public class editStudent extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
   String id=req.getParameter("id");
   String state=req.getParameter("state");
   selectInformation selectInformation =new selectInformation();
   if (state.equals("1")){
       selectInformation.postStudent("update student set 状态='正常'  where 学号="+id);
   }
  else if (state.equals("0")){
       selectInformation.postStudent("update student  set 状态='缺勤' where 学号="+id);
   }

    }
}
